<template>
  <particles
    id="tsparticles"
    class="login__particles"
    :options="particlesConfig"
  />
  <div class="form-position">
    <div class="form-container">
      <div class="form-container-border">
        <div style="margin: 10px auto; text-align: center">
          <p class="title">{{ globalConfig.system.title }}</p>
        </div>
        <el-form :model="loginForm" :rules="loginFormRules" ref="loginFormRef">
          <el-form-item prop="username">
            <el-input
              v-model.trim="loginForm.username"
              prefix-icon="UserFilled"
              placeholder="请输入用户名"
              clearable
            ></el-input>
          </el-form-item>
          <el-form-item prop="password">
            <el-input
              v-model.trim="loginForm.password"
              prefix-icon="Lock"
              type="password"
              placeholder="请输入密码"
              show-password
              clearable
              @keyup.enter="submit"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button
              style="width: 100%; float: left; border-radius: 30px"
              @click="submit"
              >登录
            </el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<!-- script setup 写法 -->
<script lang="ts" setup>
import login from "@/views/login/login";
import { particlesConfig } from "@/config/particles-config";
import globalConfig from "@/config/global-config";

const { loginFormRef, loginForm, loginFormRules, submit } = login();
</script>

<style lang="less">
.form-container-border {
  input.el-input__inner {
    border-radius: 30px;
    font-size: 18px;
  }

  i.el-input__icon {
    margin-left: 10px;
  }

  .el-input--prefix .el-input__inner {
    padding-left: 40px;
  }
}
</style>

<style scoped lang="less">
.login__particles {
  height: 100%;
  width: 100%;
  z-index: 3;
  position: fixed;
  background-image: url("../../assets/img/background/login.jpeg");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.form-position {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
}

.form-container {
  background: rgba(176, 226, 255, 0.2);
  padding: 20px;
  border-radius: 10px;
  height: fit-content;
  width: 550px;
}

.form-container-border {
  margin: 0 auto;
  width: 500px;

  input.el-input__inner {
    border-radius: 30px;
    font-size: 18px;
  }

  i.el-input__icon {
    margin-left: 10px;
  }

  .el-input--prefix .el-input__inner {
    padding-left: 40px;
  }
}

.logo-style {
  width: auto;
  height: 40px;
}

.title {
  font-family: KaiTi, sans-serif;
  text-align: center;
  color: #cae1ff;
  font-size: 32px;
  font-weight: 500;
  padding-bottom: 20px;
}
</style>
